/*
* Copyright (C) 2009-2011 - Roman Kalynchuk
*
* This file is part of REngine.
*
* REngine is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* REngine is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with REngine.  If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef __IRESOURCE_H__
#define __IRESOURCE_H__

#include "kernel/crc.h"
#include "kernel/refcount.h"

namespace rengine3d {

	class IResource: public CRefCount {
	public:
		IResource(){};
		IResource(string_t name);
		virtual ~IResource();

		virtual void Init(void) = 0;
		virtual void Shutdown(void) = 0;

		virtual string_t GetName( void );

		uint GetHandle(void);
		void SetHandle(uint handle);

		virtual bool Reload(void) = 0;
		virtual void Unload(void) = 0;
	protected:
		string_t	m_name;
		string_t	m_filePath;
		uint		m_handle;
	};

	r_inline IResource::IResource(string_t name) {
		m_name		= name;
		m_handle	= MakeCRC(m_name.c_str());
	}

	r_inline IResource::~IResource() {
	}

	r_inline uint IResource::GetHandle(void) {
		return m_handle;
	}

	r_inline void IResource::SetHandle(uint handle) {
		m_handle = handle;
	}

	r_inline string_t IResource::GetName( void ) {
		return m_name;
	}

}

#endif
